<!-- 蓝色登录页面2 -->
<template>
	<view class="total">
		<view class="img-a"  style="background-image: url('/static/bac1.png')">
			<view class="textPart">
				<view class="hello">
					<image style="width: 300rpx;height: 80rpx;" src="/static/Hello！.png" mode=""></image>
				</view>
				<view class="title">
					欢迎登录
				</view>
			</view>
			
		</view>
		<view class="login-view">
			<view class="t-login">
				<form class="cl">
					<view class="t-a">
						<u-input :customStyle="inputStyle" shape="circle" class="codeInput" type="number" name="phone" placeholder="请输入手机号" maxlength="11" v-model="phone" />
					</view>
					<view class="t-a">
						<u-input :customStyle="inputStyle"  shape="circle" class="codeInput" placeholder="请输入验证码" v-model="code">
							<template slot="suffix">
								<u-code
								ref="uCode"
								@change="codeChange"
								:seconds="seconds"
								changeText="X秒">
								</u-code>
								<text style="font-size: 12px;font-family: PingFangSC-Regular, PingFang SC;font-weight: 400;color: #666666;"
								@tap="getCode"
								:text="tips"
								>{{tips}}</text>
							</template>
						</u-input>
					</view>
					<button class="login_button" v-if="beAgreen" style="background-color:#A8A8A8;">登 录</button>
					<button class="login_button" v-else @tap="login()">登 录</button>
					<view class="agreen">
						<view class="radios" @click="changeAgreen">
							<!-- <image style="width: 20px;height: 20px;" v-show="this.beAgreen" src="@/static/select.png" alt="" width="100%" height="100%">
							<image style="width: 20px;height: 20px;" v-show="!this.beAgreen" src="@/static/selected.png" alt="" width="100%" height="100%"> -->
						</view>
						<view class="texts">
							我已阅读并同意<text class="txts" >《用户协议》</text>和<text  class="txts">《隐私协议》</text>
						</view>
					</view>
				</form>
			</view>
		</view>
	</view>
</template>
<script>
// import {login1} from "@/utils/api.js";
export default {
	data() {
		return {
			phone: '', //手机号码，
			code:'', //验证码
			beAgreen:true,
			tips: '发送验证码',
			seconds:60,
			test:'',
			inputStyle:{
				background:'#F5F7FB',
				margin:'40rpx 0 40rpx 0',
				border:'none'
			},
		};
	},
	onUnload(){
		
	},
	methods: {
		goBack(){
		
		},
		codeChange(text) {
			this.tips = text;
		},
		getCode() {
			var that =this
			if (!/^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(that.phone)) {
				uni.showToast({ title: '请输入正确手机号', icon: 'none' });
				return;
			}
			if (this.$refs.uCode.canGetCode) {
			// 模拟向后端请求验证码
			uni.showLoading({
				title: '正在获取验证码'
			})
			setTimeout(() => {
				uni.hideLoading();
				// 这里此提示会被this.start()方法中的提示覆盖
				uni.$u.toast('验证码已发送');
				// 通知验证码组件内部开始倒计时
				this.$refs.uCode.start();
			}, 2000);
			} else {
				uni.$u.toast('倒计时结束后再发送');
			}
		},
		changeAgreen(){
			this.beAgreen=!this.beAgreen
		},
		
		//当前登录按钮操作
		login() {
			var that = this;
			if (!that.phone) {
				uni.showToast({ title: '请输入您的手机号', icon: 'none' });
				return;
			}
			if (!/^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(that.phone)) {
				uni.showToast({ title: '请输入正确手机号', icon: 'none' });
				return;
			}
			if (!that.code) {
				uni.showToast({ title: '请输入您的验证码', icon: 'none' });
				return;
			}
		},
	},
	}
</script>
<style lang="scss" scoped>
.total{
	background-color: #F7FBFE;
	height: 100vh;
	position: relative;
}
.txt {
	font-size: 32rpx;
	font-weight: bold;
	color: #333333;
}
.img-a {
	padding-top: 20px;
	width: 100%;
	height: 450rpx;
	background-repeat: no-repeat;
	background-size: 100%;
	position: relative;
	.textPart{
		position: absolute;
		bottom: 72rpx;
		left: 44rpx;
		.hello{
			width: 300rpx;
			height: 80rpx;
		}
		.title{
			margin-top: 30rpx;
			font-size: 36rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #333333;
			line-height: 50rpx;
		}
	}
	
}
.reg {
	font-size: 28rpx;
	color: #fff;
	height: 90rpx;
	line-height: 90rpx;
	border-radius: 50rpx;
	font-weight: bold;
	background: #f5f6fa;
	color: #000000;
	text-align: center;
	margin-top: 30rpx;
}

.login-view {
	background: #FFFFFF;
	border-radius: 5px;
	width: 90%;
	height: 718rpx;
	margin: auto;
	
}

.t-login {
	width: 600rpx;
	margin: 0 auto;
	font-size: 28rpx;
	padding-top: 60rpx;
	.welcome{
		font-size: 36rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #333333;
	}
	.log_style{
		margin-top: 25px;
		.blue_font{
			color: #2796f2;
			font-size: 18px;
			font-family: PingFang SC;
			font-weight: 800;
		}
		.tishi{
			margin-top: 10px;
			margin-bottom: 50px;
			font-size: 12px;
			font-family: PingFang SC;
			font-weight: 500;
			color: #868686;
		}
	}
	#getCodeButton{
		width: 80px;
		background-color: #2796f2;
		border-color: #2796f2;
		border-radius: 24px;
		height: 28px;
	}
	.codeInput{
		height: 33px;
		line-height: 90rpx;
		margin-top: 30rpx;
		margin-bottom: 50rpx;
		border-radius: 50rpx;
		background-color: #F6F6F6;
		font-size: 28rpx;
		padding: 0 15px;
	}
}

.t-login .login_button {
	margin-top: 20px;
	font-size: 35rpx;
	background: #2796f2;
	color: #fff;
	height: 90rpx;
	width: 250px;
	line-height: 90rpx;
	border-radius: 50rpx;
	font-weight: bold;
}
.t-login .t-a {
	position: relative;
}

.t-b {
	text-align: left;
	font-size: 42rpx;
	color: #ffffff;
	padding: 130rpx 0 0 70rpx;
	font-weight: bold;
	line-height: 70rpx;
}

.t-login .t-c {
	position: absolute;
	right: 22rpx;
	top: 22rpx;
	background: #5677fc;
	color: #fff;
	font-size: 24rpx;
	border-radius: 50rpx;
	height: 50rpx;
	line-height: 50rpx;
	padding: 0 25rpx;
}

.t-login .t-d {
	text-align: center;
	color: #999;
	margin: 80rpx 0;
}

.t-login .t-e {
	text-align: center;
	width: 250rpx;
	margin: 80rpx auto 0;
}

.t-login .t-g {
	float: left;
	width: 50%;
}

.t-login .t-e image {
	width: 50rpx;
	height: 50rpx;
}

.t-login .t-f {
	text-align: center;
	margin: 150rpx 0 0 0;
	color: #666;
}

.t-login .t-f text {
	margin-left: 20rpx;
	color: #aaaaaa;
	font-size: 27rpx;
}

.t-login .uni-input-placeholder {
	color: #aeaeae;
}

.cl {
	zoom: 1;
	.agreen{
		margin-top: 40rpx;
		display: flex;
			.radios{
				width: 28px;
				height: 20px;
				margin-right:10px ;
			}
			.texts{
				font-size: 24rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #666666;
				.txts{
					color:#5398F6;
				}
			}
		
	}
}

.cl:after {
	clear: both;
	display: block;
	visibility: hidden;
	height: 0;
	content: '\20';
}
</style>
